package com.rwx.myjava03_springboot02.controller;

import com.rwx.myjava03_springboot02.common.Result;
import com.rwx.myjava03_springboot02.entity.BookUser;
import com.rwx.myjava03_springboot02.entity.Environments;
import com.rwx.myjava03_springboot02.service.BookUserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.Arrays;
import java.util.List;

@RestController
@RequestMapping("/books")
public class BookController {

    @Value("${lesson}")
    private String lessonName;
    @Value("${enterprise.subject[0]}")
    private String[] subject;

    @Autowired
    private Environments environment;
    @Autowired
    private BookUserService bookUserService;


    @RequestMapping
    public Result list(){
//        System.out.println(lessonName+"~~~"+ Arrays.asList(subject).toString());
//        System.out.println(environment.toString());
        List<BookUser> bookList = bookUserService.getBookList();
        return Result.success(bookList);
    }
}
